<?php
/**
 * Abstract class for plugins type of <i>Psa_Plugin_Before_Group_Delete</i>.
 * 
 * LICENSE:
 * 
 * This library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with This library. If not, see <{@link http://www.gnu.org/licenses/}>.
 *
 * @link http://code.google.com/p/phpstartapp/
 * @author Bojan Mauser <bmauser@gmail.com>
 * @copyright Bojan Mauser 2009
 * @package psa
 * @subpackage plugins
 * @version $Id: $
 */


/**
 * Abstract class for plugins type of <i>Psa_Plugin_Before_Group_Delete</i>.
 * Before the group is deleted from database with {@link psa_group_del()} function, 
 * {@link psa_main()} method of the plugin object that extends this class will be called.
 * You can write <i>Psa_Plugin_Before_Group_Delete</i> plugins by extending this class. Here is an example:
 * 
 * <code>
 * <?php
 * class my_plugin extends Psa_Plugin_Before_Group_Delete{
 * 	
 * 	// you have to define psa_main() method in your child class
 * 	function psa_main($group){
 * 
 * 		// authorize group
 * 		// this makes sense if $group is group ID
 * 		$group = new Psa_Group($group);
 * 		
 * 		// delete folder associated with the group
 * 		rmdir ('/var/groups/' . $group->name);
 * 	}
 * }
 * ?>
 * </code>
 * 
 * When this example plugin is registered, before every group deletion with {@link psa_group_del()} function
 * folder associated with group will be deleted.
 * 
 * <b>Note:</b> argument of the {@link psa_main()} method can be integer (group ID) or string (group name) this depends on
 * what you pass to {@link psa_group_del()} function.
 * 
 * @see Psa_Group
 * @see Psa_Plugin_After_Group_Delete
 */
abstract class Psa_Plugin_Before_Group_Delete extends Psa_Plugin_Model{
	
	
	/**
	 * This method will be called before the group is deleted from database with {@link psa_group_del()} function.
	 * @param int|string $group ID or name of the group to be deleted. Same as passed to {@link psa_group_del()} function.
	 * @see psa_group_del()
	 */
	abstract protected function psa_main($group);
}

